package chapter07

import scala.collection.immutable
import scala.collection.parallel.immutable.ParSeq

/**
  *
  * @author Pop
  * @date 2022/7/4 22:04
  */
object Test20_Parallel {

  def main(args: Array[String]): Unit = {
    // 默认是一个Range
    val strings: immutable.IndexedSeq[String] = (1 to 100).map(
      x => Thread.currentThread().getName
    )
//    strings
    // 并行执行
    val string1: ParSeq[String] = (1 to 100).par.map(
      x => Thread.currentThread().getName
    )

  }

}
